{% extends "../main.html" %}

{% block title %}{{ _("Password Security") }}{% end %}

{% block content %}
    {% if user.has_item("Password Security") %}
        {% if user.next_algorithm() is not None %}
            <div class="container">
                <h1>
                    <i class="fa fa-lock"></i>
                    {{ _("Password Security") }}
                </h1>
                <br />
                  {% if errors is not None and len(errors) != 0 %}
                    {% for error in errors %}
                      <div class="alert alert-error">
                        <a class="close" data-dismiss="alert" href="#">&times;</a>
                        <h4 class="alert-heading">{{ _("ERROR") }}</h4>
                        {{ error }}
                      </div>
                    {% end %}
                  {% end %}
                <div class="well">
                    <h4>{{ _("Current algorithm") }}: {{ user.algorithm.upper() }}</h4>
                    <br />
                    <form class="form-horizontal" action="/password_security" method="post" autocomplete="off">
                          {% raw xsrf_form_html() %}
                          <div class="control-group">
                            <label class="control-label" for="old_password">{{ _("Current Bank Account Password") }}</label>
                            <div class="controls">
                                  <input required name="old_password" id="old_password" placeholder="{{ _('Current Bank Password') }}" type="password" />
                            </div>
                          </div>
                          <div class="control-group">
                            <label class="control-label" for="new_password1">{{ _("New Bank Account Password") }}</label>
                            <div class="controls">
                                  <input required name="new_password1" id="new_password1" placeholder="{{ _('New Password') }}" type="password" />
                            </div>
                          </div>
                          <div class="control-group">
                            <label class="control-label" for="new_password2">{{ _("Confirm Bank Account New Password") }}</label>
                            <div class="controls">
                                  <input required name="new_password2" id="new_password2" placeholder="{{ _('Confirm New Password') }}" type="password" />
                            </div>
                          </div>
                          <div class="control-group">
                            <div class="controls">
                                  <button class="btn btn-primary" type="submit">
                                      {{ _("Upgrade to") }} {{ user.next_algorithm()[2].upper() }} {{ _("for") }} {{ _("$") }}{{ cost * user.next_algorithm()[1] }}
                                  </button>
                            </div>
                          </div>
                      </form>
                </div>
            </div>
        {% else %}
            <div class="container well">
                <h1>{{ _("No upgrades left.") }}</h1>
            </div>
        {% end %}
    {% else %}
        <h1>{{ _("You do not own this upgrade.") }}</h1>
    {% end %}
{% end %}
